﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Adm_ExpnseList.aspx.cs" Inherits="ArtLand.OA.Project.ADM.Adm_ExpnseList" %>


<!DOCTYPE html>




<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>1</title>
    <link href="../css/admin.css" rel="stylesheet" />
    <style type="text/css">
        .x-grid3-row-body .dt_box {
            background: white;
            border-bottom: 1px dashed #D8D8D8;
            word-wrap: break-word;
            word-break: break-all;
            overflow: hidden;
        }

            .x-grid3-row-body .dt_box p {
                color: #666;
                font-size: 14px;
                line-height: 24px;
            }

        .cont2_span {
            line-height: 23px;
            color: #b2b2b2;
            display: inline-block;
        }

            .cont2_span a {
                text-decoration: underline;
            }

            .cont2_span img {
                vertical-align: middle;
                margin-right: 2px;
                padding-bottom: 2px;
            }
    </style>
    <style>
        .mygrid-row-summary.x-grid3-row {
            background-color: #efefef !important;
            background-image: none !important;
            border-color: #fff #ededed #ededed !important;
            visibility: hidden;
        }

            .mygrid-row-summary.x-grid3-row .x-grid3-td-numberer, .mygrid-row-summary.x-grid3-row .x-grid3-td-checker {
                background-image: none !important;
            }

                .mygrid-row-summary.x-grid3-row .x-grid3-td-numberer .x-grid3-col-numberer, .mygrid-row-summary.x-grid3-row .x-grid3-td-checker .x-grid3-col-checker {
                    display: none;
                }

            .mygrid-row-summary.x-grid3-row td {
                font-size: 14px;
                line-height: 16px;
                font-weight: bold;
                color: blue;
            }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <ext:PageManager ID="PageManager1" runat="server" AutoSizePanelID="pan1" />
        <ext:Panel ShowBorder="false" ShowHeader="false" runat="server" ID="pan1" Layout="Fit">
            <Toolbars>
                <ext:Toolbar ID="Toolbar2" runat="server">
                    <Items>
                        <ext:TwinTriggerBox ID="ttbxMyBox2" ShowLabel="false" OnTrigger1Click="ttbxMyBox2_Trigger1Click"
                            OnTrigger2Click="ttbxMyBox2_Trigger2Click" Trigger1Icon="Clear" ShowTrigger1="False"
                            EmptyText="请输入申请人姓名或费用类型" Trigger2Icon="Search" runat="server" Width="200px">
                        </ext:TwinTriggerBox>
                        <ext:ToolbarSeparator></ext:ToolbarSeparator>
                        <ext:Label Text="使用日期：">
                        </ext:Label>
                        <ext:DatePicker runat="server" Width="90px" Label="开始日期" ID="txt_StartTime1" EnableDateSelect="true">
                        </ext:DatePicker>
                        <ext:Label Text="&nbsp;&nbsp;至&nbsp;&nbsp;">
                        </ext:Label>
                        <ext:DatePicker ID="txt_EndTime1" Width="90px" Label="结束日期" DateFormatString="yyyy-MM-dd" runat="server"
                            EnableDateSelect="true">
                        </ext:DatePicker>
                        <ext:Button ID="find" runat="server" Text="查找" Icon="Find" OnClick="Unnamed_Click"></ext:Button>
                    </Items>
                </ext:Toolbar>
            </Toolbars>
            <Items>
                <ext:Grid ID="Grid1" Title="通知/公告管理" ShowHeader="false" ShowBorder="false" runat="server" EnableCheckBoxSelect="false" DataKeyNames="ID,STATUS"
                    OnRowDataBound="Grid1_RowDataBound" AllowPaging="true" OnRowSelect="Grid1_RowSelect" EnableRowSelect="true" IsDatabasePaging="true" PageSize="10" OnPageIndexChange="Grid1_PageIndexChange" OnRowCommand="Grid1_RowCommand" EnableColumnLines="true">
                    <Toolbars>
                        <ext:Toolbar ID="Toolbar1" runat="server">
                            <Items>
                                <ext:Button ID="btnNew" Text="申请" Icon="Add" EnablePostBack="false" runat="server">
                                </ext:Button>
                                <ext:ToolbarSeparator></ext:ToolbarSeparator>
                                <ext:Button ID="Button1" Text="修改" Enabled="false" OnClick="Button1_Click" Icon="ApplicationEdit" runat="server">
                                </ext:Button>
                                <ext:ToolbarSeparator></ext:ToolbarSeparator>
                                <ext:Button ID="Button2" Text="删除" Enabled="false" OnClick="Button2_Click" Icon="Delete" runat="server" ConfirmText="您确定要这么做吗？">
                                </ext:Button>
                                <ext:ToolbarText ID="ToolbarText1" runat="server" Enabled="false" Text="<span style='color:#999'>双击可编辑数据</span>"></ext:ToolbarText>
                                <ext:ToolbarFill></ext:ToolbarFill>
                                <ext:ToolbarText Text="<b>点击+查看相关备注信息</b>"></ext:ToolbarText>
                            </Items>
                        </ext:Toolbar>
                    </Toolbars>
                    <Columns>
                        <ext:TemplateField RenderAsRowExpander="true">
                            <ItemTemplate>
                                <div class="dt_box" style="padding-left: 10px;">
                                    <table>
                                        <tbody>
                                            <tr>
                                                <td class="text_box" colspan="2">
                                                    <p style="color: #bbb;"><span class="name">备注：<%#Eval("REMARK") %></span></p>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>

                            </ItemTemplate>
                        </ext:TemplateField>
                        <ext:BoundField Width="80px" DataField="USRNAM" DataFormatString="{0}" HeaderText="费用申请人" TextAlign="Center" />
                        <ext:BoundField Width="100px" DataField="MoneyType" DataFormatString="{0}" HeaderText="费用类型" TextAlign="Center" />
                        <ext:BoundField Width="100px" DataField="Auditer" DataFormatString="{0}" HeaderText="审批人" TextAlign="Center" />
                        <ext:BoundField Width="100px" DataField="AMOUNT" DataFormatString="{0}" HeaderText="费用金额" TextAlign="Center" />
                        <ext:BoundField Width="100px" DataField="PLDATE" DataFormatString="{0:yyyy-MM-dd}" HeaderText="使用日期" TextAlign="Center" />
                        <ext:BoundField Width="170px"  ColumnID="major"  DataField="APDATE" DataFormatString="{0:yyyy-MM-dd}" HeaderText="申请日期" TextAlign="Center" />
                        <ext:CheckBoxField Width="180px"  ColumnID="donate" DataField="CHKBUG" RenderAsStaticField="true" HeaderText="是否在预算内" TextAlign="Center" />
                        <ext:BoundField Width="80px" DataField="STATUS" DataFormatString="{0}" HeaderText="状态" TextAlign="Center" />
                        <ext:WindowField ColumnID="myWindowField" Width="90px" WindowID="Window1" DataTextFormatString="{0}" DataIFrameUrlFields="ID"
                            DataIFrameUrlFormatString="Adm_ExpnseChange.aspx?id={0}&s=1" DataWindowTitleField="USRNAM"
                            DataWindowTitleFormatString="审批行政费用" TextAlign="Center" HeaderText="操作" Text="进行审批" />
                    </Columns>
                </ext:Grid>
            </Items>
        </ext:Panel>
        <ext:Window runat="server" ID="Window2" Popup="false" IsModal="true">
            <Items>
                <ext:Button ID="Button3" runat="server" Text="审批通过" Icon="Accept"></ext:Button>
                <ext:Button ID="Button4" runat="server" Text="审批不通过" Icon="Decline"></ext:Button>
            </Items>
        </ext:Window>
        <ext:Window ID="Window1" Title="编辑" Popup="false" EnableIFrame="true" runat="server"
            CloseAction="HidePostBack" EnableConfirmOnClose="true" IFrameUrl="about:blank" Target="Top" IsModal="True" Width="550px" Height="400px">
        </ext:Window>
    </form>
    <script src="../js/extgridbug.js"></script>
    <script>

        var gridClientID = '<%= Grid1.ClientID %>';
        var gridSummaryID = '<%=t %>';
        function ttt()
        {
            alert("123");
        }

        function customsummary(idt, clietid) {

            var grid = X(clietid);

            var donateTotal = 0, store = grid.getStore(), view = grid.getView(), storeCount = store.getCount();

            // 防止重复添加了合计行
            //if (Ext.get(view.getRow(storeCount - 1)).hasClass('mygrid-row-summary')) {
            //    return;
            //}
            //  alert(gridSummaryID);
            // 从隐藏字段获取全部数据的汇总
            var summaryJSON = JSON.parse(idt);


            store.add(new Ext.data.Record({
                'major': '行政费用金额总计',
                'donate': summaryJSON['donateTotal'].toFixed(2)
            }));


            // 为合计行添加自定义样式（隐藏序号列、复选框列，取消 hover 和 selected 效果）
            var summaryNode = Ext.get(view.getRow(storeCount)).addClass('mygrid-row-summary');

            // 找到合计行的外部容器节点
            var viewportNode = summaryNode.parent('.x-grid3-viewport');
            // 删除容器节点下直接子节点为 mygrid-row-summary 的节点
            viewportNode.select('> .mygrid-row-summary').remove();

            // 创建合计行的副本
            var cloneSummaryNode = summaryNode.dom.cloneNode(true);
            // 修改合计行的副本的样式，绝对定位，距离底部0px，显示副本（默认是占位隐藏 visibility: hidden;）
            Ext.get(cloneSummaryNode).setStyle({
                position: 'absolute',
                bottom: 0,
                visibility: 'visible'
            });
            //alert(cloneSummaryNode);
            // 向容器节点添加合计行的副本
            viewportNode.appendChild(cloneSummaryNode);

        }

        function calcGridSummary(grid) {
            var donateTotal = 0, store = grid.getStore(), view = grid.getView(), storeCount = store.getCount();

            // 防止重复添加了合计行
            if (Ext.get(view.getRow(storeCount - 1)).hasClass('mygrid-row-summary')) {
                return;
            }
           //  alert(gridSummaryID);
            // 从隐藏字段获取全部数据的汇总
            var summaryJSON = JSON.parse(gridSummaryID);
           

            store.add(new Ext.data.Record({
                'major': '行政费用金额总计',
                'donate': summaryJSON['donateTotal'].toFixed(2)
            }));


            // 为合计行添加自定义样式（隐藏序号列、复选框列，取消 hover 和 selected 效果）
            var summaryNode = Ext.get(view.getRow(storeCount)).addClass('mygrid-row-summary');

            // 找到合计行的外部容器节点
            var viewportNode = summaryNode.parent('.x-grid3-viewport');
            // 删除容器节点下直接子节点为 mygrid-row-summary 的节点
            viewportNode.select('> .mygrid-row-summary').remove();

            // 创建合计行的副本
            var cloneSummaryNode = summaryNode.dom.cloneNode(true);
            // 修改合计行的副本的样式，绝对定位，距离底部0px，显示副本（默认是占位隐藏 visibility: hidden;）
            Ext.get(cloneSummaryNode).setStyle({
                position: 'absolute',
                bottom: 0,
                visibility: 'visible'
            });
            //alert(cloneSummaryNode);
            // 向容器节点添加合计行的副本
            viewportNode.appendChild(cloneSummaryNode);

        }

        // 页面第一个加载完毕后执行的函数
        function onReady() {
            var grid = X(gridClientID);
            grid.addListener('viewready', function () {
                calcGridSummary(grid);
            });

            // 防止选中合计行
            grid.getSelectionModel().addListener('beforerowselect', function (sm, rowIndex, keepExisting, record) {
                if (Ext.get(grid.getView().getRow(rowIndex)).hasClass('mygrid-row-summary')) {
                    return false;
                }
                return true;
            });
        }

        // 页面AJAX回发后执行的函数
        function onAjaxReady() {
            var grid = X(gridClientID);
            calcGridSummary(grid);
        }
    </script>
</body>
</html>
